package com.cuz.hot100;

public class Q70climbStairs {
    public int climbStairs(int n) {
        return solution9(n);
    }
    public static int solution9(int n) {
        if (n <= 0) {
            return 0;
        }
        if (n == 1) {
            return 1;
        }
        if (n == 2) {
            return 2;
        }
        int pre1 = 1;
        int pre2 = 2;
        for (int i = 3; i <= n; i++) {
            int pre=pre1+pre2;
            pre1=pre2;
            pre2=pre;
        }
        return pre2;
    }
}
